package cn.hnh.controller;

import cn.hnh.service.TagsService;
import cn.hnh.vo.ArticleTitleVo;
import cn.hnh.vo.Result;
import cn.hnh.vo.TagsVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author HuangNianHong
 * @Time 2021/1/5
 */
@RestController
@Api(tags = "博客标签接口文档描述")
public class TagsController {
    @Autowired
    private TagsService tagsService;

    @ApiOperation(value = "查询标签信息")
    @RequestMapping("/tags")
    public Result<TagsVo> getTagsVo(){
        return tagsService.getTagsVo();
    }

    @ApiOperation(value = "查询某个标签下的文章标题对象")
    @RequestMapping("/tags/{tagsName}")
    public Result<List<ArticleTitleVo>> getArticleTitleVo(@PathVariable("tagsName")String tagsName){
        return tagsService.getArticleTitleVoByTagsName(tagsName);
    }
}
